﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ColladaDotNet;

namespace contentviewer.ViewModel
{
	class GeometryViewModel : NodeViewModel
	{
		readonly  geometry _geometry;

		public GeometryViewModel(NodeViewModel root, NodeViewModel parent, geometry geometry)
            : base(root, parent)
        {
			_geometry = geometry;
        }

		public string Content
		{
			get
			{
				var geoHeader = "";
				if (string.IsNullOrEmpty(_geometry.name))
					geoHeader += "geometry";
				else
					geoHeader += (_geometry.name);

				if (!string.IsNullOrEmpty(_geometry.GetId()))
					geoHeader += " <" + _geometry.GetId() + ">";
				return geoHeader;
			}
		}

        protected override void LoadChildren()
        {
            base.LoadChildren();
        }

		public override bool IsSelected
		{
			get
			{
				return base.IsSelected;
			}
			set
			{
				if (value == true)
					(Root as ColladaNodeViewModel).SelectedItems.Add(this);
				else
					(Root as ColladaNodeViewModel).SelectedItems.Remove(this);
				base.IsSelected = value;
			}
		}

		public override string ToString()
		{
			return this.Content;
		}
	}
}
